project(${ED_CORE_LIBRARY})

#--------------------------------------
# Main target
#--------------------------------------
add_definitions(-DED_CORE_EXPORTS)

include_directories(
  include
  ${CMAKE_CURRENT_BINARY_DIR}
)

file(GLOB_RECURSE ED_CORE_HEADERS . "include/ed_core/*.h")

add_library(${ED_CORE_LIBRARY} SHARED
  src/global/library.cpp

# Tests
  src/tests/die.cpp
  src/tests/modifier.cpp
  src/tests/modifiable.cpp
  src/tests/step.cpp
  src/tests/test.cpp

# Date & time
  src/time/datetime.cpp
  src/time/clock.cpp

  ${ED_CORE_HEADERS}
)

target_link_libraries(${ED_CORE_LIBRARY}
  Qt5::Core
)

#--------------------------------------
# Installation directives
#--------------------------------------

# Target
install(TARGETS
  ${ED_CORE_LIBRARY}
RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR})

# Headers
macro(install_headers folder)
  file(GLOB HEADER_FILES . "include/ed_core/${folder}/*.h")
  install(FILES ${HEADER_FILES} DESTINATION ${INCLUDE_INSTALL_DIR}/ed_core/${folder})
endmacro(install_headers folder)

install_headers(character)
install_headers(global)
install_headers(tests)
install_headers(time)
